home *** CD-ROM | disk | FTP | other *** search
Oberon Document | 1995-08-30 | 4.5 KB | 132 lines | [oODC/obnF] |
- Documents.StdDocumentDesc
- Documents.DocumentDesc
- Containers.ViewDesc
- Views.ViewDesc
- Stores.StoreDesc
- Documents.ModelDesc
- Containers.ModelDesc
- Models.ModelDesc
- Stores.ElemDesc
- TextViews.StdViewDesc
- TextViews.ViewDesc
- TextModels.StdModelDesc
- TextModels.ModelDesc
- TextModels.AttributesDesc
- Helvetica
- Helvetica
- Helvetica
- Helvetica
- Helvetica
- MODULE ObxWrappers;
- IMPORT Dialog, Stores, Models, Views, Controllers, Properties, Out;
- CONST minVersion = 0; maxVersion = 1;
- TYPE
- View = POINTER TO RECORD (Views.ViewDesc)
- v: Views.View
- END;
- PROCEDURE (v: View) Internalize (VAR rd: Stores.Reader);
- VAR s: Stores.Store; thisVersion: SHORTINT;
- BEGIN
- v.Internalize^(rd);
- IF ~rd.cancelled THEN
- rd.ReadVersion(minVersion, maxVersion, thisVersion);
- IF ~rd.cancelled THEN
- rd.ReadStore(s); v.v := s(Views.View)
- END
- END
- END Internalize;
- PROCEDURE (v: View) Externalize (VAR wr: Stores.Writer);
- BEGIN
- v.Externalize^(wr);
- wr.WriteVersion(maxVersion);
- wr.WriteStore(v.v)
- END Externalize;
- PROCEDURE (v: View) CopyFrom (source: Views.View);
- VAR st: Stores.Store;
- BEGIN
- WITH source: View DO
- st := Stores.Clone(source.v); v.v := st(Views.View);
- v.v.CopyFrom(source.v)
- END
- END CopyFrom;
- PROCEDURE (v: View) InitModel (model: Models.Model);
- BEGIN
- v.v.InitModel(model)
- END InitModel;
- PROCEDURE (v: View) ThisModel (): Models.Model;
- BEGIN
- RETURN v.v.ThisModel()
- END ThisModel;
- PROCEDURE (v: View) Flush;
- BEGIN
- v.Flush
- END Flush;
- PROCEDURE (v: View) InitContext (context: Models.Context);
- BEGIN
- v.InitContext^(context);
- v.v.InitContext(context) (* wrapper and wrapped view share the same context *)
- END InitContext;
- PROCEDURE (v: View) ConsiderFocusRequestBy (view: Views.View);
- BEGIN
- v.v.ConsiderFocusRequestBy(view)
- END ConsiderFocusRequestBy;
- PROCEDURE (v: View) Neutralize;
- BEGIN
- v.v.Neutralize
- END Neutralize;
- (* NewFrame: wrapper uses standard frame *)
- (* Background: wrapper has no intrinsic background color *)
- PROCEDURE (v: View) Restore (f: Views.Frame; l, t, r, b: LONGINT);
- BEGIN
- Views.InstallFrame(f, v.v, 0, 0, 0, TRUE)
- END Restore;
- (* RestoreMarks: wrapper has no intrinsic marks, wrapped view's RestoreMarks is called by framework *)
- (* HandleModelMsg: framework performs message propagation *)
- (* HandleViewMsg: framework performs message propagation *)
- PROCEDURE (v: View) HandleCtrlMsg (f: Views.Frame; VAR msg: Controllers.Message; VAR focus: Views.View);
- BEGIN
- WITH msg: Controllers.EditMsg DO
- (* sample special behavior: copy typing into log *)
- IF msg.op = Controllers.pasteChar THEN Out.Char(msg.char); Out.Ln END
- ELSE
- END;
- focus := v.v (* forward all controller messages to wrapped view *)
- END HandleCtrlMsg;
- PROCEDURE (v: View) HandlePropMsg (VAR msg: Properties.Message);
- BEGIN
- Views.HandlePropMsg(v.v, msg)
- END HandlePropMsg;
- PROCEDURE Wrap*;
- VAR poll: Controllers.PollOpsMsg; w: View; replace: Controllers.ReplaceViewMsg;
- BEGIN
- Controllers.PollOps(poll);
- IF (poll.singleton # NIL) & ~(poll.singleton IS View) THEN
- NEW(w); w.v := poll.singleton;
- replace.old := poll.singleton; replace.new := w;
- Controllers.Forward(replace)
- ELSE Dialog.Beep
- END
- END Wrap;
- PROCEDURE Unwrap*;
- VAR poll: Controllers.PollOpsMsg; replace: Controllers.ReplaceViewMsg;
- BEGIN
- Controllers.PollOps(poll);
- IF (poll.singleton # NIL) & (poll.singleton IS View) THEN
- replace.old := poll.singleton; replace.new := poll.singleton(View).v;
- Controllers.Forward(replace)
- ELSE Dialog.Beep
- END
- END Unwrap;
- END ObxWrappers.
- TextControllers.StdCtrlDesc
- TextControllers.ControllerDesc
- Containers.ControllerDesc
- Controllers.ControllerDesc
- TextRulers.StdRulerDesc
- TextRulers.RulerDesc
- TextRulers.StdStyleDesc
- TextRulers.StyleDesc
- TextRulers.AttributesDesc
- Helvetica
- Documents.ControllerDesc
-